<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<script src="../../../../resources/gesture-util.js"></script>
<style type="text/css">
::-webkit-scrollbar {
  background-color: #ccc;
  height: 15px;
  width: 15px;
}

::-webkit-scrollbar-button {
  display: none;
}

::-webkit-scrollbar-thumb {
  background-color: #777;
  height: 15px;
  width: 15px;
}

#text {
  height: 300px;
  width: 200px;
}
</style>
<textarea id="text">
Attack your ankles catnip leap hiss chase the red dot, zzz run run I don't like
that food puking eat feed me.  Attack shed everywhere sleep on your face
scratched bat sleep on your keyboard, chase the red dot attack your ankles
attack biting eat the grass bat.  Sunbathe chase the red dot eat the grass
attack sleep on your face rip the couch, toss the mousie sleep in the sink lick
climb the curtains.  I don't like that food meow climb the curtains toss the
mousie tail flick stuck in a tree, judging you toss the mousie stretching
hairball biting attack.  Give me fish eat judging you claw, eat biting I don't
like that food toss the mousie catnip sleep in the sink toss the mousie purr.
Sniff sleep on your keyboard eat the grass lick, rip the couch give me fish
leap bat shed everywhere knock over the lamp jump on the table toss the mousie.
</textarea>

<script type="text/javascript">
var textArea = document.getElementById('text');
promise_test (async () => {
  var scrollbarX = textArea.offsetLeft + textArea.offsetWidth - 5;
  var scrollThumbSafeOffset = 20;
  var scrollbarY = textArea.offsetTop + scrollThumbSafeOffset;
  assert_equals(textArea.scrollTop, 0);
  await smoothScroll(20, scrollbarX, scrollbarY, GestureSourceType.TOUCH_INPUT,
                     "up", SPEED_INSTANT);
  await waitFor( () => { return textArea.scrollTop > 0; });
}, 'This tests scroll gesture events on a textarea scrollbar. The textarea ' +
   'below should be slightly scrolled down if successful.');
</script>
